sudo apt-get install -y mysql-server-core-5.5

sudo apt-get install -y mysql-server

sudo apt-get install -y mysql-client-core-5.5

sudo sed -i 's/bind-address/#bind-address/g' /etc/mysql/my.cnf
sudo /etc/init.d/mysql restart


-- gdybym instalator nie zapytal o zmiane hasla, to 2 ponizsze linijki
update user set password=PASSWORD('paweligawel12') where user = 'root';
FLUSH PRIVILEGES; exit;

mysql -u root --password="paweligawel12" -e "show databases;"

mysql -u root --password="paweligawel12" -e "create database petclinic;"
mysql -u root --password="paweligawel12" -e "grant all on petclinic.* to 'petclinic'@'%' identified by 'paweligawel12';"

mysql -u root --password="paweligawel12" -e "grant all on petclinic.* to 'petclinic'@'localhost' identified by 'paweligawel12';"

mysql -u root --password="paweligawel12" petclinic < initDB.sql
mysql -u root --password="paweligawel12" petclinic < populateDB.sql




sudo echo "10.204.114.40 db1" >> /etc/hosts
sudo echo "10.204.49.200 db2" >> /etc/hosts
